package com.hanxiaozhang.autocinfigure;

import org.springframework.core.convert.converter.Converter;

/**
 * 〈一句话功能简述〉<br>
 * 〈星号乘法转换器〉
 *
 * @author hanxinghua
 * @create 2022/9/15
 * @since 1.0.0
 */

public class AsteriskMultiplyConverter implements Converter<String, AsteriskMultiply> {

    @Override
    public AsteriskMultiply convert(String str) {
        Integer sum = 1;
        String[] array = str.split("\\*");
        for (String item : array) {
            sum *= Integer.parseInt(item);
        }
        return AsteriskMultiply.of(sum);
    }

}
